/*  ISCII  INDEX
   161-163: 0-2 :{z,M,H}
   164-178: 3-17: Vowels
   179-216:18-55: Consonants
     217  :  56 : Invisible(Consonant)
   218-231:57-70: Matraas
     232  :  71 : Halant_marker
     233  :  72 : Nukta
     234  :  73 : Khadii_paii
   235-238:74-77: Reserved_for_future_extensions
     239  :  78 : Attribute_code
     240  :  79 : Extension_code
   241-250:80-89: Numerals
   251-254:90-93: Reserved_for_future_extensions
   NOTE: Nukta's "normal treatment" is same as that of consonant. Special treatment after vowel etc. is pretty simple. 
*/
#include <stdio.h>
#include <string.h>
#define DEBUG 0
iscii2wx(char input[],char output[]){
char iscii2wx[2][91] = {"zMHaAiIuUqeeEEooOOkKgGfcCjJFtTdDNwWxXnnpPbBmyyrrlllvSRsh*_______________Z.******0123456789","**********V**YV**YaaaaaaaaaaaaaaaaaaaaYaaaaaaYaYaVYaaaaa*AiIuUqeeEeooOo*******************"};
int i,j,k=0,l;
unsigned char c,next_c;
int halant_absorbed=0; // A flag
int nukta_absorbed=0; // A flag
c=input[0];
if (c=='\0') return(1);
l=strlen(input);
for(j=1;j<=l;j++){
next_c=input[j];
if(c<161){output[k++]=c; c=next_c; continue;}
if(c>250){c=next_c; continue;}
i=c-161;
switch(i){
case 0: case 1: case 2: case 3: case 4: case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:
case 17 : output[k++]=iscii2wx[0][i];
	  if((i == 10) || (i == 14)) output[k++]='V';
	  if((i == 13) || (i == 17)) output[k++]='Y';
	  break;
/*
case 13:  output[k++]='e'; output[k++]='Y'; break;
case 17:  output[k++]='o'; output[k++]='Y'; break;
*/

case 18 :case 19 :
case 20 :case 21 :case 22 :case 23 :case 24 :case 25 :case 26 :case 27 :case 28 :case 29 :
case 30 :case 31 :case 32 :case 33 :case 34 :case 35 :case 36 :case 37 :case 38 :case 39 :
case 40 :case 41 :case 42 :case 43 :case 44 :case 45 :case 46 :case 47 :case 48 :case 49 :
case 50 :case 51 :case 52 :case 53 :case 54 :case 55 :
case 56 : output[k++]=iscii2wx[0][i];
                    if(next_c==232) {halant_absorbed = 1;break;}
                    if(next_c==233) {nukta_absorbed = 1;output[k++]='Z';break;}
                    if(next_c > 217 && next_c < 232){next_c=next_c-53;break;}/* In the next_c replaced matraa by corresponding vowel because halant part as been absorbed */
                    output[k++]='a'; break;

case 57 :case 58 :case 59 :
case 60 :case 61 :case 62 :case 63 :case 64 :case 65 :case 66 :case 67 :case 68 :case 69 :
case 70 : output[k++]=iscii2wx[1][i]; break;

case 71 : if(halant_absorbed){halant_absorbed=0;} else output[k++]='_'; break;

case 72 : if(nukta_absorbed){nukta_absorbed=0;} else output[k++]='Z'; 
                    if(next_c==232) {halant_absorbed = 1;break;}
                    if(next_c > 217 && next_c < 232){next_c=next_c-53;break;}/* In the next_c replaced matraa by corresponding vowel because halant part as been absorbed */
                    output[k++]='a'; break;

case 73 : output[k++]='.'; break;
default    : output[k++]=iscii2wx[0][i]; 
         }
c=next_c;
}
output[k]='\0';
}
/*
 main(){
char input1[100000],output1[200000];
int c,i=0;
while((c=getchar())!=EOF) input1[i++]=c;
input1[i]='\0';
iscii2wx(input1,output1);
printf("%s",output1);
}
*/
